package com.buptlogistics.creditinvestigation.fragment;


import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.Spinner;
import android.widget.TextView;

import com.buptlogistics.creditinvestigation.R;
import com.buptlogistics.creditinvestigation.activity.CommonActivity;
import com.buptlogistics.creditinvestigation.app.BaseFragment;

import java.util.ArrayList;
import java.util.List;

/**
 * 应收账款贷款详情
 */
public class DeserveDetailFragment extends BaseFragment {

    private View view;
    private Button btn_add;
    private Button btn_next;
    private Button btn_update;

    private List<String> companyNamesList = new ArrayList<String>();

    private Spinner spn_company;
    ArrayAdapter<String> schoolAdapt;
    private int loan_type;

    private String applyEntity;

    private TextView tv_start;
    private TextView tv_end;
    private TextView tv_money;
    private TextView tv_num;

    private String company;
    private String name;
    private String num;
    private String price;
    private String start;
    private String end;

    public DeserveDetailFragment() {
        // Required empty public constructor
    }


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        view = inflater.inflate(R.layout.fragment_deserve_detail, container, false);
        initViews();
        initEvents();
        return view;
    }

    protected void initViews() {
        btn_next = (Button) findViewById(R.id.btn_deserve_detail_next);
        btn_add = (Button) findViewById(R.id.btn_deserve_detail_add);
        btn_update = (Button) findViewById(R.id.btn_deserve_detail_update_image);
        spn_company = (Spinner) findViewById(R.id.spn_deserve_detail_company_name);
        tv_start = (TextView) findViewById(R.id.tv_deserve_detail_start);
        tv_end = (TextView) findViewById(R.id.tv_deserve_detail_end);
        tv_money = (TextView) findViewById(R.id.tv_deserve_detail_money);
        tv_num = (TextView) findViewById(R.id.tv_deserve_detail_order_num);
    }

    protected void initEvents() {
        btn_next.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Bundle data = new Bundle();
                data.putInt("fragmentType", 4);
                // 创建一个Intent
                Intent intent = new Intent(DeserveDetailFragment.this.getActivity(), CommonActivity.class);
                intent.putExtras(data);
                // 启动intent对应的Activity
                startActivity(intent);
            }
        });

    }

    protected View findViewById(int id) {
        return view.findViewById(id);
    }


}
